<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String ctx = request.getContextPath();
    request.setAttribute("ctx", ctx);
%>
<html>
<head>
    <title>Title</title>
    <script src="/bootstrap/jquery-1.9.1.min.js"></script>
    <link rel="stylesheet" href="${ctx}/css/index_work.css">
</head>
<body>
<form>
    <input type="hidden"name="pageNum">
    <input type="text" name="dname">
    <input type="submit" value="查询">
</form>
<a href="${ctx}/toadd.do"><button>添加</button></a>
<table>
    <tr>
        <td></td>
        <td>编号</td>
        <td>店铺名称</td>
        <td>创建日期</td>
        <td>图片</td>
        <td>销售商品</td>
        <td>操作</td>
    </tr>
    <c:forEach items="${pageInfo.list}" var="s">
        <tr>
            <td>
                <input type="checkbox" name="id" value="${s.did}">
            </td>
            <td>${s.did}</td>
            <td>${s.dname}</td>
            <td>${s.create_date}</td>
            <td>
                 <input type="image" style="height: 30px;width: 30px" value=" ${s.img}">
            </td>
            <td>
                <c:forEach items="${s.shops}" var="ss">
                    ${ss.sname}
                </c:forEach>
            </td>
            <td>
                <a href="${ctx}/toadd.do?did=${s.did}">修改</a>
                <a href="${ctx}/xq.do?did=${s.did}">详情</a>
            </td>
        </tr>
    </c:forEach>
</table>
<a href="##" onclick="fenye(1)">首页</a>
<a href="##" onclick="fenye(${pageInfo.isFirstPage?1:pageInfo.prePage})">上一页</a>
<a href="##" onclick="fenye(${pageInfo.isLastPage?pageInfo.pages:pageInfo.nextPage})">下一页</a>
<a href="##" onclick="fenye(${pageInfo.pages})">尾页</a>
共${pageInfo.total}条数据,${pageInfo.pageNum}/${pageInfo.pages}页
</body>
<script>
    function fenye(pageNum) {
        $("[name='pageNum']").val(pageNum);
        $("form").submit();
    }
</script>
</html>
